import React, { FC, createElement } from 'react';
import { BaseWrapper } from '../base';
import { useFormContainerSelector } from '../../form-container';
import { generatorClass } from '../../utils';
import classNames from 'classnames';
import { BaseFieldFile } from './base-field-file';

export interface FieldFileProps {
  max: string;
}

export const FieldFile: FC<FieldFileProps> = (props: any) => {
  const { columnConfig, onChange, value, ...otherProps } = props;
  const className = classNames(generatorClass('filed-file'));
  const [readonly] = useFormContainerSelector((s) => [s.readonly]);

  const disabled = readonly || columnConfig?.status === '2';

  return (
    <BaseWrapper {...props}>
      <BaseFieldFile className={className} uploadProps={{ disabled }} {...props} />
    </BaseWrapper>
  );
};
